-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix-component-undefined-svelte-v5 #12102
Fix-component-undefined-svelte-v5 #12102
Conversation
🦋 Changeset detectedLatest commit: ffa87ee The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @hermit99, the suggestion would be to revert the file and only move the addEventlistener from line 44 up to line 42 at the end of the else-block. That would ensure that component
is always defined when referenced and would also fix the issue that the listener is currently added too often
Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com>
Thanks @martrapp. Pardon me as I'm new to Astro's code base. Your suggestion makes more sense, and I really appreciate it ❤️ |
Thank you very much for taking care! 💜 |
* - fix: 'component is not defined' error when unmount svelte 5 component * added changeset * Moving unmount listener to where the component is defined. * Update .changeset/eighty-ligers-punch.md Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com> --------- Co-authored-by: Martin Trapp <94928215+martrapp@users.noreply.github.com>
* - fix: 'component is not defined' error when unmount svelte 5 component * added changeset * Moving unmount listener to where the component is defined. * Update .changeset/eighty-ligers-punch.md --------- Co-authored-by: Hermit <70563349+hermit99@users.noreply.github.com>
Changes
Small code enhancement, which is easy to understand.
Console error:
Testing
Defensive code added and tested locally.
Docs